home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Newbie C question
- Date: Thu, 22 Feb 96 23:34:32 GMT
- Organization: none
- Message-ID: <825032072snz@genesis.demon.co.uk>
- References: <Dn4us9.Mu@undergrad.math.uwaterloo.ca>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <Dn4us9.Mu@undergrad.math.uwaterloo.ca>
- sckettle@undergrad.math.uwaterloo.ca "Steve Kettle" writes:
-
- >Hi, how the heck does one convert the error codes found in <errno.h>
- >to strings? I heard about a perror function but can't find it.
-
- Any good book on C should document perror() since it is part of the
- standard library.
-
- #include <stdio.h>
-
- void perror(const char *s);
-
- s is either a null pointer or a pointer to a string. If s points to
- a non-zero length string it is written to stderr followed by the characters
- ':' and ' '. An error message corresponding to the value in errno is then
- written and finally a newline character. The error message is the same as
- that returned by the strerror() (with a suitable argument).
-
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-